// pages/mine/mine.js 
const app = getApp()
Page({

  /**
   * 页面的初始数据 
   */ 
  data: {
    iscompany:false,
    status:true
  },
  approveHandle: function() {
    wx.navigateTo({
      url: '/pages/approve/approve',
    })
  },
  approveHandle2: function () {
    wx.navigateTo({
      url: '/pages/company/company',
    })
  },
  cardList: function () {
    wx.navigateTo({
      url: '/pages/cardList/cardList',
    })
  },
  packetList: function () {
    wx.navigateTo({
      url: '/pages/packetList/packetList',
    })
  },
  rank: function () {
    wx.navigateTo({
      url: '/pages/rank/rank',
    })
  },
  totixian: function () {
    wx.navigateTo({
      url: "/pages/withdraw/withdraw",
    })
  },
  glodenPigHandle: function () {
    wx.navigateTo({
      url: '/pages/companyGoldenPig/companyGoldenPig',
    })
  },
  mypig:function(){
    wx.navigateTo({
      url: '/pages/goldenPig/goldenPig',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
    var that = this;
    wx.request({
      url: app.siteinfo.rootpath +'mine',
      method:"get",
      data:{
        id:app.siteinfo.userinfo.id
      },
      success:function(res){
        app.siteinfo.userinfo.money = res.data.userinfo.money
        app.siteinfo.userinfo.iscompany = res.data.userinfo.iscompany
        that.setData({
          userinfo:res.data.userinfo,
          iscompany: 0
        })
      }
    })
  },
  onGotUserInfo: function () {
    var that = this;
    
    that.setData({
      status: false
    })
    app.onGotUserInfo();
    app.siteinfo.islogin = true;
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage: function () {

  // }
})